package com.axxc.jpa.task.rabbitmsg.receiver;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 
 * @ClassName RabbitMqTopicExchangeMsgReceiver
 * @Description 消费topic.messages队列中的消息
 * @author xxc
 * @data 2018年8月4日上午12:10:35
 */
@Component
@RabbitListener(queues = "topic.messages")
public class RabbitMqTopicExchangeMsgReceiverB {

	private Logger logger = LoggerFactory.getLogger(getClass());

	@RabbitHandler
	public void processA(String msg) {
		/**
		 * sender1发送的消息,routing_key是“topic.message”，所以exchange里面的绑定的binding_key是
		 * “topic.message”，topic.＃都符合路由规则;所以sender1发送的消息，两个队列都能接收到；
		 */
		logger.info("topicMessagesReceiver  -消费者  : {}", msg);
	}
}
